home *** CD-ROM | disk | FTP | other *** search
/ MacAddict 108 / MacAddict108.iso / Software / Internet & Communication / WordPress 1.5.1.dmg / wordpress / wp-admin / index.php < prev    next >
Encoding:
PHP Script  |  2005-04-22  |  5.7 KB  |  173 lines

  1. <?php
  2. require_once('admin.php'); 
  3. $title = __('Dashboard'); 
  4. require_once('admin-header.php');
  5. require_once (ABSPATH . WPINC . '/rss-functions.php');
  6.  
  7. $today = current_time('mysql', 1);
  8. ?>
  9.  
  10. <div class="wrap">
  11. <div id="zeitgeist">
  12. <h2><?php _e('Latest Activity'); ?></h2>
  13. <?php
  14. if ( $recentposts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'publish' AND post_date_gmt < '$today' ORDER BY post_date DESC LIMIT 5") ) :
  15. ?>
  16. <div>
  17. <h3><?php _e('Posts'); ?> <a href="edit.php" title="<?php _e('More posts...'); ?>">»</a></h3>
  18. <ul>
  19. <?php
  20. foreach ($recentposts as $post) {
  21.     if ($post->post_title == '')
  22.         $post->post_title = sprintf(__('Post #%s'), $post->ID);
  23.     echo "<li><a href='post.php?action=edit&post=$post->ID'>";
  24.     the_title();
  25.     echo '</a></li>';
  26. }
  27. ?>
  28. </ul>
  29. </div>
  30. <?php endif; ?>
  31.  
  32. <?php
  33. if ( $scheduled = $wpdb->get_results("SELECT ID, post_title, post_date_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_date_gmt > '$today'") ) :
  34. ?> 
  35. <div>
  36. <h3><?php _e('Scheduled Entries:') ?></h3>
  37. <ul>
  38. <?php
  39. foreach ($scheduled as $post) {
  40.     if ($post->post_title == '')
  41.         $post->post_title = sprintf(__('Post #%s'), $post->ID);
  42.     echo "<li>" . sprintf(__('%1$s in %2$s'), "<a href='post.php?action=edit&post=$post->ID' title='" . __('Edit this post') . "'>$post->post_title</a>", human_time_diff( current_time('timestamp', 1), strtotime($post->post_date_gmt. ' GMT') ))  . "</li>";
  43. }
  44. ?> 
  45. </ul>
  46. </div>
  47. <?php endif; ?>
  48.  
  49. <?php
  50. if ( $comments = $wpdb->get_results("SELECT comment_author, comment_author_url, comment_ID, comment_post_ID FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 5") ) :
  51. ?>
  52. <div>
  53. <h3><?php _e('Comments'); ?> <a href="edit-comments.php" title="<?php _e('More comments...'); ?>">»</a></h3>
  54. <ul>
  55. <?php 
  56. foreach ($comments as $comment) {
  57.     echo '<li>' . sprintf(__('%1$s on %2$s'), get_comment_author_link(), '<a href="'. get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID . '">' . get_the_title($comment->comment_post_ID) . '</a>');
  58.     edit_comment_link(__("Edit"), ' <small>(', ')</small>'); 
  59.     echo '</li>';
  60. }
  61. ?>
  62. </ul>
  63. <?php 
  64. if ( $numcomments = $wpdb->get_var("SELECT COUNT(*) FROM $tablecomments WHERE comment_approved = '0'") ) :
  65. ?>
  66. <p><strong><a href="moderation.php"><?php echo sprintf(__('There are comments in moderation (%s)'), number_format($numcomments) ); ?> »</a></strong></p>
  67. <?php endif; ?>
  68. </div>
  69.  
  70. <?php endif; ?>
  71.  
  72. <div>
  73. <h3><?php _e('Blog Stats'); ?></h3>
  74. <?php
  75. $numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish'");
  76. if (0 < $numposts) $numposts = number_format($numposts); 
  77.  
  78. $numcomms = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'");
  79. if (0 < $numcomms) $numcomms = number_format($numcomms);
  80.  
  81. $numcats = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->categories");
  82. if (0 < $numcats) $numcats = number_format($numcats);
  83. ?>
  84. <p><?php printf(__('There are currently %1$s <a href="%2$s" title="Posts">posts</a> and %3$s <a href="%4$s" title="Comments">comments</a>, contained within %5$s <a href="%6$s" title="categories">categories</a>.'), $numposts, 'edit.php',  $numcomms, 'edit-comments.php', $numcats, 'categories.php'); ?></p>
  85. </div>
  86.  
  87. <?php
  88. $rss = @fetch_rss('http://feeds.technorati.com/cosmos/rss/?url='. trailingslashit(get_option('home')) .'&partner=wordpress');
  89. if ( isset($rss->items) && 0 != count($rss->items) ) {
  90. ?>
  91. <div id="incominglinks">
  92. <h3><?php _e('Incoming Links'); ?> <cite><a href="http://www.technorati.com/cosmos/search.html?url=<?php echo trailingslashit(get_option('home')); ?>&partner=wordpress"><?php _e('More'); ?> »</a></cite></h3>
  93. <ul>
  94. <?php
  95. $rss->items = array_slice($rss->items, 0, 10);
  96. foreach ($rss->items as $item ) {
  97. ?>
  98.     <li><a href="<?php echo wp_filter_kses($item['link']); ?>"><?php echo wp_specialchars($item['title']); ?></a></li>
  99. <?php } ?>
  100. </ul>
  101. </div>
  102. <?php } ?>
  103.  
  104. </div>
  105.  
  106. <h2><?php _e('Dashboard'); ?></h2>
  107. <p><?php _e('Below is the latest news from the official WordPress development blog, click on a title to read the full entry.'); ?></p>
  108. <?php
  109. $rss = @fetch_rss('http://wordpress.org/development/feed/');
  110. if ( isset($rss->items) && 0 != count($rss->items) ) {
  111. ?>
  112. <h3>WordPress Development Blog</h3>
  113. <?php
  114. $rss->items = array_slice($rss->items, 0, 3);
  115. foreach ($rss->items as $item ) {
  116. ?>
  117. <h4><a href='<?php echo wp_filter_kses($item['link']); ?>'><?php echo wp_specialchars($item['title']); ?></a> — <?php echo human_time_diff( strtotime($item['pubdate'], time() ) ); ?> <?php _e('ago'); ?></h4>
  118. <p><?php echo $item['description']; ?></p>
  119. <?php
  120.     }
  121. }
  122. ?>
  123.  
  124.  
  125. <?php
  126. $rss = @fetch_rss('http://planet.wordpress.org/feed/');
  127. if ( isset($rss->items) && 0 != count($rss->items) ) {
  128. ?>
  129. <div id="planetnews">
  130. <h3><?php _e('Other WordPress News'); ?> <a href="http://planet.wordpress.org/"><?php _e('more'); ?> »</a></h3>
  131. <ul>
  132. <?php
  133. $rss->items = array_slice($rss->items, 0, 20);
  134. foreach ($rss->items as $item ) {
  135. ?>
  136. <li><a href='<?php echo wp_filter_kses($item['link']); ?>'><?php echo wp_specialchars($item['title']); ?></a></li>
  137. <?php
  138.     }
  139. ?>
  140. </ul>
  141. </div>
  142. <?php
  143. }
  144. ?>
  145. <div style="clear: both"> 
  146. <br clear="all" />
  147. </div>
  148. </div>
  149. <?php
  150. $drafts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'draft' AND post_author = $user_ID");
  151. if ($drafts) {
  152. ?>
  153. <div class="wrap">
  154.  
  155.     <p><strong><?php _e('Your Drafts:') ?></strong> 
  156.     <?php
  157.     $i = 0;
  158.     foreach ($drafts as $draft) {
  159.         if (0 != $i)
  160.             echo ', ';
  161.         $draft->post_title = stripslashes($draft->post_title);
  162.         if ($draft->post_title == '')
  163.             $draft->post_title = sprintf(__('Post #%s'), $draft->ID);
  164.         echo "<a href='post.php?action=edit&post=$draft->ID' title='" . __('Edit this draft') . "'>$draft->post_title</a>";
  165.         ++$i;
  166.         }
  167.     ?> 
  168.     .</p> 
  169. </div>
  170. <?php } ?>
  171. <?php
  172. require('./admin-footer.php');
  173. ?>